import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
  name: 'login',
  path: '/login',
  component: () => import('../views/login/index.vue')
},
{
  path: '/',
  component: () => import('@/views/layout'),
  redirect: '/home',
  children: [
    {
      path: 'home', // 默认子路由
      name: 'home',
      component: () => import('@/views/home/index.vue')
    },
    {
      path: 'qa',
      name: 'qa',
      component: () => import('@/views/qa')
    },
    {
      path: 'video',
      name: 'video',
      component: () => import('@/views/video')
    },
    {
      path: 'my',
      name: 'my',
      component: () => import('@/views/my')
    }
  ]
}
]

const router = new VueRouter({
  routes
})

export default router
